package model

import modelApp.PartidaAppModel
import org.uqbar.arena.layout.ColumnLayout
import org.uqbar.arena.layout.VerticalLayout
import org.uqbar.arena.widgets.Panel
import org.uqbar.arena.windows.WindowOwner
import templates.MyOwnSimpleWindow
import templates.ResolverMisterioTemplate

class ResolverMisterioWindow extends MyOwnSimpleWindow<PartidaAppModel>{
	
	val template = new ResolverMisterioTemplate
	
	new(WindowOwner parent, Partida partida) {
		super(parent, new PartidaAppModel(partida))
	}
	
	override createContents(Panel mainPanel) {
		this.setTitle("Resolviendo: Robo del Faraón")
		
		val panelMaster = new Panel(mainPanel).setLayout(new VerticalLayout)
		
		val panelSuperior = new Panel(panelMaster).setLayout(new ColumnLayout(2))
		val panelInferior = new Panel(panelMaster).setLayout(new VerticalLayout)
		
		val panelOpciones = new Panel(panelSuperior).setLayout(new VerticalLayout)
		val panelLugares = new Panel(panelSuperior).setLayout(new VerticalLayout)
		
		val panelRecorrido = new Panel(panelInferior).setLayout(new VerticalLayout)
		val panelDestinosFallidos = new Panel(panelInferior).setLayout(new VerticalLayout)
		
	template.crearOpcionesDeJuego(panelOpciones, "detective.paisActual",
		[| new OrdenDeArrestoView(this, this.modelObject.detective, this.modelObject.partida.bddVillano).open],
		[| new ViajarMisterioView(this, this.modelObject.partida, this.modelObject.container).open],
		[| new ExpedienteMisterioView(this, this.modelObject.partida.bddVillano).open])
		
		
		
		template.crearOpcionesDeLugares(panelLugares,this.modelObject.detective.paisActual.lugaresInteresantes.get(0).toString ,this.modelObject.nombreLugar(1),this.modelObject.nombreLugar(2),
			[| new PistasLugaresView(this,this.modelObject.partida, 0).open],
			[| new PistasLugaresView(this,this.modelObject.partida, 1).open],
			[| new PistasLugaresView(this,this.modelObject.partida, 2).open])
		
		template.crearRecorrido(panelRecorrido, "container.recorridoSeguidoString")
		
		template.crearListaDestinosFallidos(panelDestinosFallidos, "container.destinosFallidos")
	}
}